#pragma once

#include "Command.h"

namespace Networking
{
    class MessageParser
    {
    public:
        Command ParseMessage(const QString& msg, int senderID = -1) const;
        virtual ~MessageParser(){}


        QString removeEOM(const QString& param) const;
    private:
        Command parseClientRequest(const QString& msg, int senderID) const;
        Command parseServerCommand(const QString& msg) const;

        Command createRequest(Command::CommandType, const QStringList&) const;

        Tank::CardinalDirection parseDirection(const QString& dir) const;
        Tank::ActionType parseActionType(const QString& dir) const;
        Tanks getTanks(const QStringList& msgParts, int tanksCnt, int entrySize) const;
        Bullets getBullets(const QStringList& msgParts, int lastTankEntry, int bulletEntrySize) const;
    };
}
